home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 November / EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso / earcd / util / misc / executiv.lha / Executive_V1.00 / sysinfo.lzx / include / libraries / sysinfo.h
C/C++ Source or Header  |  1991-03-28  |  7KB  |  244 lines

  1. #ifndef LIBRARIES_SYSINFO_H
  2. #define LIBRARIES_SYSINFO_H
  3.  
  4. /*
  5. **      $VER: sysinfo.h 1.0 (14.3.95)
  6. **      Sysinfo Release 1.0
  7. **
  8. **      sysinfo.library definitions
  9. **
  10. **      This file is public domain.
  11. **
  12. **      Author: Petri Nordlund <petrin@mits.mdata.fi>
  13. **
  14. **      $Id: sysinfo.h 1.1 1995/05/28 13:21:08 petrin Exp petrin $
  15. **
  16. */
  17.  
  18. #ifndef EXEC_TYPES_H
  19. #include "exec/types.h"
  20. #endif /* EXEC_TYPES_H */
  21.  
  22. #ifndef EXEC_PORTS_H
  23. #include "exec/ports.h"
  24. #endif /* EXEC_PORTS_H */
  25.  
  26.  
  27. #define SYSINFONAME        "sysinfo.library"
  28. #define SYSINFOVERSION    1L
  29.  
  30.  
  31. /*
  32.  * This structure is returned by InitSysinfo() and it's READ-ONLY.
  33.  *
  34.  * NOTE!! This structure will grow in the future, so don't make any assumptions
  35.  * about it's length.
  36.  *
  37.  */
  38.  
  39. struct sysinfo {
  40. /* general */
  41.     int        errno;                    /* Used to hold error values                 */
  42.                                     /* from some functions                        */
  43. /* load average */
  44.     UWORD    loadavg_type;            /* load average type, see below                */
  45.     UWORD    loadavg_time1;            /* Usually 1, 5 and 15 minutes.                */
  46.     UWORD    loadavg_time2;            /* These times are in seconds.                */
  47.     UWORD    loadavg_time3;            /* 0 = time not implemented                    */
  48.     UWORD    fscale;                    /* scale value, if lavgtype = FIXED             */
  49.  
  50. /* id */
  51.     BOOL    GetPpid_implemented;    /* TRUE if GetPpid is implemented            */
  52.     BOOL    GetPgrp_implemented;    /* TRUE if GetPgrp is implemented            */
  53.  
  54. /* get/setnice */
  55.     UWORD    which_implemented;        /* Search methods for Get/SetNice            */
  56.     WORD    nicemin;                /* Nice-value giving most cpu time            */
  57.     WORD    nicemax;                /* Nice-value giving least cpu time            */
  58.  
  59. /* notify */
  60.     BOOL    notify_sig_implemented;    /* Notify by signal implemented                */
  61.     BOOL    notify_msg_implemented;    /* Notify by message implemented            */
  62.  
  63. /* cpu usage */
  64.     UWORD    cpu_usage_implemented;    /* What cpu usage values are implemented    */
  65.  
  66. /* task cpu usage */
  67.     UWORD    task_cpu_usage_implemented;    /* What cpu usage values are implemented*/
  68. };
  69.  
  70.  
  71. /*
  72.  * general
  73.  *
  74.  */
  75.  
  76. /* errno values */
  77. #define    WHICH_EPERM            1        /* Operation not permitted */
  78. #define    WHICH_ESRCH            3        /* No such process */
  79. #define    WHICH_EACCES        13        /* Permission denied */
  80. #define    WHICH_EINVAL        22        /* Invalid argument */
  81.  
  82.  
  83. /*
  84.  * load average
  85.  *
  86.  */
  87.  
  88. /* Loadaverage type */
  89. #define LOADAVG_NONE        0        /* load averages not implemented            */
  90. #define LOADAVG_FIXEDPNT    1        /* load * fscale                             */
  91. #define LOADAVG_FLOAT        2        /* floating point numbers                    */
  92.  
  93. /* GetLoadAverage */
  94. struct loadaverage_fixed {
  95.     ULONG    load1;
  96.     ULONG    load2;
  97.     ULONG    load3;
  98. };
  99.  
  100. struct loadaverage_float {
  101.     float    load1;
  102.     float    load2;
  103.     float    load3;
  104. };
  105.  
  106. /* This is needed when calling GetLoadAverage() */
  107. struct loadaverage {
  108.     union {
  109.         struct loadaverage_fixed    lavg_fixed;
  110.         struct loadaverage_float    lavg_float;
  111.     } loadaverage;
  112.     ULONG    reserved1;                /* Reserved for future use */
  113.     ULONG    reserved2;                /* Reserved for future use */
  114. };
  115.  
  116. /*
  117.  * get/setnice
  118.  *
  119.  */
  120.  
  121. /* Possible search methods for Get/SetNice */
  122. #define WHICH_PRIO_PROCESS        0
  123. #define WHICH_PRIO_PGRP            1
  124. #define WHICH_PRIO_USER            2
  125. #define WHICH_PRIO_TASK            3
  126.  
  127. /* These bits are used in which_implemented-field */
  128. #define WHICHB_PRIO_PROCESS        0
  129. #define WHICHB_PRIO_PGRP        1
  130. #define WHICHB_PRIO_USER        2
  131. #define WHICHB_PRIO_TASK        3
  132.  
  133. #define WHICHF_PRIO_PROCESS        (1L<<0)
  134. #define WHICHF_PRIO_PGRP        (1L<<1)
  135. #define WHICHF_PRIO_USER        (1L<<2)
  136. #define WHICHF_PRIO_TASK        (1L<<3)
  137.  
  138.  
  139. /*
  140.  * notify
  141.  *
  142.  */
  143.  
  144. /* This is needed when adding a notify-request. This may grow in future */
  145. struct sysinfo_notify {
  146.     struct MsgPort        *notify_port;    /* message port for notify-messages        */
  147.     WORD                signal;            /* signal NUMBER if you use signals        */
  148. };
  149.  
  150.  
  151. /*
  152.  * cpu usage
  153.  *
  154.  */
  155.  
  156. /* This is needed when querying cpu usage */
  157. struct cpu_usage {
  158.     ULONG    total_used_cputime;            /* Total used cputime in seconds        */
  159.     ULONG    total_elapsed_time;            /* Total used+idle cputime in seconds    */
  160.  
  161.     ULONG    used_cputime_lastsec;        /* Used cputime during last second        */
  162.     ULONG    used_cputime_lastsec_hz;    /* 100 * lastsec / lastsec_hz = CPU %    */
  163.  
  164.     ULONG    recent_used_cputime;        /* Recently used cputime                */
  165.     ULONG    recent_used_cputime_hz;        /* 100 * recent / hz = RECENT CPU %        */
  166.     UWORD    recent_seconds;                /* "recent" means this many seconds        */
  167.  
  168.     ULONG    involuntary_csw;            /* Involuntary context switches         */
  169.     ULONG    voluntary_csw;                /* Voluntary context switches            */
  170.     ULONG    total_csw;                    /* Total # of context switches            */
  171.  
  172.     ULONG    involuntary_csw_lastsec;    /* Involuntary csws during last second  */
  173.     ULONG    voluntary_csw_lastsec;        /* Voluntary csws during last second    */
  174.     ULONG    total_csw_lastsec;            /* Total # of csws during last second    */
  175.  
  176.     ULONG    reserved[12];                /* Reserved for future use                */
  177. };
  178.  
  179. /* These bits are used in cpu_usage_implemented-field */
  180. #define CPU_USAGEB_TOTAL_IMPLEMENTED            0
  181. #define CPU_USAGEB_LASTSEC_IMPLEMENTED            1
  182. #define CPU_USAGEB_RECENT_IMPLEMENTED            2
  183. #define CPU_USAGEB_IVVOCSW_IMPLEMENTED            3
  184. #define CPU_USAGEB_TOTALCSW_IMPLEMENTED            4
  185. #define CPU_USAGEB_IVVOCSW_LASTSEC_IMPLEMENTED    5
  186. #define CPU_USAGEB_TOTALCSW_LASTSEC_IMPLEMENTED    6
  187.  
  188. #define CPU_USAGEF_TOTAL_IMPLEMENTED            (1L<<0)
  189. #define CPU_USAGEF_LASTSEC_IMPLEMENTED            (1L<<1)
  190. #define CPU_USAGEF_RECENT_IMPLEMENTED            (1L<<2)
  191. #define CPU_USAGEF_IVVOCSW_IMPLEMENTED            (1L<<3)
  192. #define CPU_USAGEF_TOTALCSW_IMPLEMENTED            (1L<<4)
  193. #define CPU_USAGEF_IVVOCSW_LASTSEC_IMPLEMENTED    (1L<<5)
  194. #define CPU_USAGEF_TOTALCSW_LASTSEC_IMPLEMENTED    (1L<<6)
  195.  
  196.  
  197. /*
  198.  * task cpu usage
  199.  *
  200.  */
  201.  
  202. /* This is needed when querying cpu usage of a task */
  203. struct task_cpu_usage {
  204.     ULONG    total_used_cputime;            /* Total used cputime                      */
  205.     ULONG    total_used_time_hz;            /* used_cputime / hz = cputime in secs    */
  206.     ULONG    total_elapsed_time;            /* Total used+idle cputime in seconds   */
  207.  
  208.     ULONG    used_cputime_lastsec;        /* Used cputime during last second        */
  209.     ULONG    used_cputime_lastsec_hz;    /* 100 * lastsec / lastsec_hz = CPU %    */
  210.  
  211.     ULONG    recent_used_cputime;        /* Recently used cputime                */
  212.     ULONG    recent_used_cputime_hz;        /* 100 * recent / hz = RECENT CPU %        */
  213.     UWORD    recent_seconds;                /* "recent" means this many seconds        */
  214.  
  215.     ULONG    involuntary_csw;            /* Involuntary context switches         */
  216.     ULONG    voluntary_csw;                /* Voluntary context switches            */
  217.     ULONG    total_csw;                    /* Total # of context switches            */
  218.  
  219.     ULONG    involuntary_csw_lastsec;    /* Involuntary csws during last second    */
  220.     ULONG    voluntary_csw_lastsec;        /* Voluntary csws during last second    */
  221.     ULONG    total_csw_lastsec;            /* Total # of csws during last second    */
  222.  
  223.     ULONG    reserved[8];                /* Reserved for future use                */
  224. };
  225.  
  226. /* These bits are used in cpu_usage_implemented-field */
  227. #define TASK_CPU_USAGEB_TOTAL_IMPLEMENTED                0
  228. #define TASK_CPU_USAGEB_LASTSEC_IMPLEMENTED                1
  229. #define TASK_CPU_USAGEB_RECENT_IMPLEMENTED                2
  230. #define TASK_CPU_USAGEB_IVVOCSW_IMPLEMENTED                3
  231. #define TASK_CPU_USAGEB_TOTALCSW_IMPLEMENTED            4
  232. #define TASK_CPU_USAGEB_IVVOCSW_LASTSEC_IMPLEMENTED        5
  233. #define TASK_CPU_USAGEB_TOTALCSW_LASTSEC_IMPLEMENTED    6
  234.  
  235. #define TASK_CPU_USAGEF_TOTAL_IMPLEMENTED                (1L<<0)
  236. #define TASK_CPU_USAGEF_LASTSEC_IMPLEMENTED                (1L<<1)
  237. #define TASK_CPU_USAGEF_RECENT_IMPLEMENTED                (1L<<2)
  238. #define TASK_CPU_USAGEF_IVVOCSW_IMPLEMENTED                (1L<<3)
  239. #define TASK_CPU_USAGEF_TOTALCSW_IMPLEMENTED            (1L<<4)
  240. #define TASK_CPU_USAGEF_IVVOCSW_LASTSEC_IMPLEMENTED        (1L<<5)
  241. #define TASK_CPU_USAGEF_TOTALCSW_LASTSEC_IMPLEMENTED    (1L<<6)
  242.  
  243. #endif /* LIBRARIES_SYSINFO_H */
  244.